import request from '@/utils/request'
import qs from 'qs'

// 获取产品列表
export async function getPageProductCard(params) {
    return await request.get('loanProduct/getHomePageProductListV2', {params})
}

// 获取公告列表
export async function getNotice() {
    return await request.post('systemNoticeList', {productName: localStorage.getItem('productName')})
}

// 校验用户添加信息
export async function userInfoVerify() {
    return await request.get('user/userInfoVerify')
}

// 上传身份信息
export async function uploadUserInfo(params) {
    return await request.post('user/dataUpload', params)
}

// 上传身份信息
export async function userInfoConfirm(params) {
    return await request.post('user/realUserInfoUpload', params)
}

// 获取个人信息下拉
export async function personalInfoSelect(params) {
    return await request.post('selectPullDownEnum', params)
}

// 获取省市区联动下拉
export async function selectCitys(params) {
    return await request.get('selectByPid', {params})
}

// 保存用户信息
export async function savePersonalInfo(params) {
    return await request.post('personalInfo', params)
}

// 保存工作信息
export async function saveWorkInfo(params) {
    return await request.post('workInfo', params)
}

// 保存联系人信息
export async function saveContacts(params) {
    return await request.post('saveContacts', params)
}

// 上传工作资料认证
export async function uploadWorkData(params) {
    return await request.post('uploadProof', params)
}

// 获取运营商列表
export async function operatorSelect(params) {
    return await request.get('operator/operatorV2', {params})
}

// 校验运营商认证是否成功
export async function isOperatorAuthSuccess(params) {
    return await request.get('operator/certification', {params})
}

// 跳过运营商认证
export async function jumpOperatorAuth() {
    return await request.post('jumpOverCertification')
}

// 第一次发送验证码
export async function operatorSend_Code1(params) {
    return await request.post('operator/getOtp1', params)
}

// 第二次发送验证码
export async function operatorSend_Code2(params) {
    return await request.post('operator/getOtp2', params)
}

// 提交第二次验证码
export async function submit_code2(params) {
    return await request.post('operator/postOtp', params)
}

// 获取银行卡列表
export async function fetchBankCard(params) {
    return await request.get('selectBlankList', {params})
}

// 添加银行卡列表
export async function addBankCard(params) {
    return await request.post('tiedCard', params)
}

// 获取我的银行卡
export async function fetchMyCard(params) {
    return await request.get('queryCard', {params})
}

// 更新银行卡状态
export async function upDateMyCard(params) {
    return await request.post('updateBankcard', params)
}

// 贷款确认
export async function loanConfirm(params) {
    return await request.get('loanProduct/loanTrial', {params})
}

// 完成申请确认
export async function applyConfirm(params) {
    return await request.post('immediatelyLoan', params)
}

// 我的贷款详情
export async function myLoanInfo(params) {
    return await request.get('loanRecordDetails', {params})
}

// 获取菜单子级内容展示
export async function fetchMenuChildShow(params) {
    return await request.get('queryResources', {params})
}

// 获取菜单父级内容
export async function fetchMenuFatherShow(params) {
    return await request.get('queryParentLevel', {params})
}

/**
 * 前端埋点
 * type 1pv 2uv
 * @param params
 */
export async function buryingPoint(params) {
    return await request.post('user/appCollectUploadH5', params)
}

/**
 * 上传设备信息
 * @param params
 * @returns {Promise<AxiosResponse<any>>}
 */
export async function uploadDeviceInfo(params) {
    return await request.post('user/uploadDeviceInfo', params)
}
